package skladowisko.utils;

import com.thoughtworks.xstream.XStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import skladowisko.Terminal;
import skladowisko.transport.Transport;

/**
 *
 * @author kedziers
 */
public class XStreamTerminalSaver implements ITerminalSaver{

    public void zapisz(Terminal terminal, String sciezkaPliku) {
        XStream xstream = new XStream();
        try {
            xstream.toXML(terminal, new FileOutputStream(sciezkaPliku));
        } catch (FileNotFoundException ex) {
            System.out.println(ex.getMessage());
        }
    }

    public void zapiszTransport(Transport transport, String sciezkaPliku) {
        XStream xstream = new XStream();
        try {
            xstream.toXML(transport, new FileOutputStream(sciezkaPliku));
        } catch (FileNotFoundException ex) {
            System.out.println(ex.getMessage());
        }
    }

}
